/**
 * 
 */
package galacticthrone.map.data.obs;

import java.util.ArrayList;
import java.util.List;

import galacticthrone.map.data.obs.Planet.Age;
import galacticthrone.map.data.obs.Planet.Distance;
import galacticthrone.map.data.obs.Planet.Temperature;
import galacticthrone.properties.Paths;

// TODO Javadoc
/**
 * <br>
 *
 * @author Jaco van der Westhuizen
 */
public class Star extends Ob
{
    /**
     * A class to contain details for each colour of stars.
     *
     * @author Jaco van der Westhuizen
     */
    abstract public static class Color
    {
        /**
         * A list of all the different colours.
         */
        public static final List<Color> ALL = new ArrayList<Color>();

        /**
         * Red stars are old and cold.  Life forms tend to be highly evolved, but are living on a dying planet.
         */
        public static final Color RED = new Color("Map/Star_red.png")
        {
            /* (non-Javadoc)
             * @see galacticthrone.map.data.system.Star.Color#createPlanet()
             */
            @Override
            public Planet createPlanet(SolarSystem system)
            {
            	// TODO Planet generation
                return new Planet(system, Age.ANCIENT, Temperature.COLD, Distance.ROCK);
            }
        };
        /**
         * Orange stars are life-giving like yellow ones, but are colder.
         */
        public static final Color ORANGE = new Color("Map/Star_orange.png")
        {
            /* (non-Javadoc)
             * @see galacticthrone.map.data.system.Star.Color#createPlanet()
             */
            @Override
            public Planet createPlanet(SolarSystem system)
            {
            	// TODO Planet generation
                return new Planet(system, Age.OLD, Temperature.MODERATE, Distance.ROCK);
            }
        };
        /**
         * Yellow stars represent stars similar to our sun.
         */
        public static final Color YELLOW = new Color("Map/Star_yellow.png")
        {
            /* (non-Javadoc)
             * @see galacticthrone.map.data.system.Star.Color#createPlanet()
             */
            @Override
            public Planet createPlanet(SolarSystem system)
            {
            	// TODO Planet generation
                return new Planet(system, Age.MODERATE, Temperature.MODERATE, Distance.ROCK);
            }
        };
        /**
         * Green stars are life-giving like yellow ones, but are hotter.
         */
        public static final Color GREEN = new Color("Map/Star_green.png")
        {
            /* (non-Javadoc)
             * @see galacticthrone.map.data.system.Star.Color#createPlanet()
             */
            @Override
            public Planet createPlanet(SolarSystem system)
            {
            	// TODO Planet generation
                return new Planet(system, Age.MODERATE, Temperature.HOT, Distance.ROCK);
            }
        };
        /**
         * White stars are very hot, making their planets very inhospitable.  This decreases the likelihood that an ancient race has harvested it, thus their planets are richer in minerals.
         */
        public static final Color WHITE = new Color("Map/Star_white.png")
        {
            /* (non-Javadoc)
             * @see galacticthrone.map.data.system.Star.Color#createPlanet()
             */
            @Override
            public Planet createPlanet(SolarSystem system)
            {
            	// TODO Planet generation
                return new Planet(system, Age.YOUNG, Temperature.HOT, Distance.ROCK);
            }
        };
        /**
         * Blue stars are very very hot and short lived, thus their planets are always dead and always mineral rich, but prohibitively expensive to live on.
         */
        public static final Color BLUE = new Color("Map/Star_blue.png")
        {
            /* (non-Javadoc)
             * @see galacticthrone.map.data.system.Star.Color#createPlanet()
             */
            @Override
            public Planet createPlanet(SolarSystem system)
            {
            	// TODO Planet generation
                return new Planet(system, Age.YOUNG, Temperature.HELLISH, Distance.ROCK);
            }
        };

        /**
         * The image to use when displaying stars of this type.
         */
        public final String texFileName;

        Color(String texFileName)
        {
        	this.texFileName = Paths.TEXTURES + texFileName;

            ALL.add(this);
        }

        /**
         * Create a planet appropriate to a star system with a star of this colour.
         * 
         * @return A planets
         */
        abstract public Planet createPlanet(SolarSystem system);
    }

    public final Color color;

    /**
     * @param color
     */
    public Star(SolarSystem system, Color color)
    {
    	super(system);

        this.color = color;
    }
}
